<?php

namespace App\Http\Services;

use App\Models\TestPaper;

class QuestionService
{
    public function typeUpdate($item)
    {
        $data = new TestPaper();
        if(isset($item['id']) && $item['id'] > 0){
            $data = TestPaper::find($item['id']);
            if(!$data){
                return false;
            }
        }else{
            $data->create_time = time();
        }
        $data->name = $item['name'];
        $data->update_time = time();
        $data->save();
        if($data->id){
            return true;
        }
        return  false;
    }
}
